home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / badges.readme < prev    next >
Encoding:
Text File  |  1992-08-26  |  2.4 KB  |  65 lines

  1.  
  2. For the next symposium about supercomputing on our computing center I
  3. was asked to make badges with TeX for the participants.  Although TeX is
  4. perhaps not the most suitable tool for such a `visual design' problem my
  5. visitcards (with our in house logos in METAFONT) made with TeX looked
  6. very similar to this problem. 
  7.  
  8. It would be nice if the badges can be made by secretaries having no
  9. experience with TeX at all. So I have made a `badges.tex' file which
  10. reads all participants names and their institution name from the file
  11. `addresses.tex'. Both are put on two consecutive lines. (The only thing I
  12. have to learn them is how to make diacritical symbols.)
  13.  
  14. I have written a TeX macro \put(x,y,box) which places the badge `box' on
  15. position x,y of the paper (x number of centimeters from the left margin
  16. and y the number of centimeters above (negative!) the upper margin) by
  17. using some dirty tricks from the TeXbook. The essential part of the
  18. `badge.tex' program now consists of the following loop:
  19.    \newread\addressfile
  20.    \newif\ifGoOn    \GoOntrue
  21.    
  22.    \openin\addressfile=addresses
  23.    \ifeof\addressfile\message{Cannot open addresses}\end\fi
  24.    
  25.    \read\addressfile to \text \let\name=\text
  26.    \loop
  27.       \read\addressfile to \text \let\inst=\text
  28.       \immediate\write16{Badge: \name \inst}
  29.       \badge{\name}{\inst}
  30.       \read\addressfile to \text \let\name=\text
  31.       \ifeof\addressfile\GoOnfalse\fi
  32.       \ifGoOn
  33.    \repeat
  34.  
  35. Here is how \badge puts the new badge on place and ejects the page:
  36.    \newcount\cnt \cnt=0
  37.    \newdimen\X \newdimen\Y \X=0cm \Y=0cm
  38.    
  39.    \def\badge#1#2{
  40.       \advance\cnt by1
  41.       \ifodd\cnt\X=0cm\advance\Y by-\height
  42.          \ifnum\Y<-\vsize\eject\cnt=1\X=0cm\Y=-\height\fi
  43.          \else\advance\X by\width
  44.       \fi
  45.       \put(\X,\Y,% don't leave this percent sign!
  46.           \vbox to \height{
  47.            \kern.5cm
  48.            {\namefont\hbox to\width{\hfill#1\hfill}}
  49.            \vfil        % next line is site dependant !!!!!!
  50.            \hbox to \width{\kern.5cm{\tue tue}\hfill{\RC RC}\kern.5cm}
  51.            \vfil        % above line is site dependant !!!!!!
  52.            {\addressfont\hbox to\width{\hfill#2\hfill}}
  53.            \kern.5cm%
  54.        })
  55.    }
  56.  
  57. For those of you who also want to make there badges with TeX I have included
  58. a shar file containing: badges.tex, a sample addresses.tex file and the
  59. PostScript result badge.ps (with our logos). (You should change the lines in
  60. which I use our logos with suitable substitutes for your company!)
  61.  
  62. Happy Badge-ing!
  63.  
  64. --Piet
  65.